var myChart = echarts.init(document.getElementById("idx1"))
var option = {
    xAxis: {
        name: '日期',
        type: 'category',
        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
    },
    yAxis: {
        name: '销售量',
        type: 'value',
        // data: [10,20,30,40],
    },
    legend: {
        show: true,
        bottom: 1,
    },
    title: {
        text: '手机销量--周子昂',
        left: 'center',
    },
    series:[{
        type:'line',
        name: '荣耀销量',
        data:[74,85,57,68,72,47,91],
        label: {
            show: true,
        },
    },{
        type:'bar',
        name: '小米销量',
        data:[85,69,71,25,79,82,80],
        label: {
            show: true,
        },
    }],
};
myChart.setOption(option)
//--------------------------------------
var myChart2 = echarts.init(document.getElementById("idx2"))
var option2 = {
    title: {
        text: '手机销量--周子昂',
        left: 'center',
    },
    xAxis: [
        {type:'category',
        gridIndex: 0,
        name:'日期',
        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
    },
        {type:'category',
        gridIndex: 1,
        name:'日期',
        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
    },
    ],
    yAxis: [
        {type:'value',gridIndex: 0,name:'销量'},
        {type:'value',gridIndex: 1,name:'销量',},
    ],
    legend: {
        show: true,
        bottom: 1,
    },
    grid: [
        {top: '20%',bottom: '25%',left: '8%',right: '62%'},
        {top: '20%',bottom: '25%',left: '53%',right: '8%'},   
    ],
    series: [{
        type:'line',
        name: '荣耀销量',
        data:[85,71,74,89,47,91,78],
        label: {
            show: true,
        },
        xAxisIndex: 0,
        yAxisIndex: 0,
    },{
        type:'line',
        name: '小米销量',
        data:[72,47,57,78,74,85,57],
        label: {
            show: true,
        },
        xAxisIndex: 0,
        yAxisIndex: 0,
    },{
        type:'bar',
        name: '荣耀销量',
        data:[85,71,74,89,47,91,78],
        label: {
            show: true,
        },
        xAxisIndex: 1,
        yAxisIndex: 1,
    },{
        type:'bar',
        name: '小米销量',
        data:[72,47,57,78,74,85,57],
        label: {
            show: true,
        },
        xAxisIndex: 1,
        yAxisIndex: 1,
    }],
};
myChart2.setOption(option2)
//--------------------------------------
var myChart3 = echarts.init(document.getElementById("idx3"))
var option3 = {
    title: {
        text: '手机销量--周子昂',
        left: 'center',
    },
    xAxis: [
        {type:'category',
        gridIndex: 0,
        name:'日期',
        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
    },
        {type:'category',
        gridIndex: 1,
        name:'日期',
        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
    },
    ],
    yAxis: [
        {type:'value',gridIndex: 0,name:'销量',},
        {
            min: 0,
            max: 400,
            gridIndex: 1,
            name:'销量',
        },
    ],
    legend: {
        show: true,
        bottom: 1,
    },
    grid: [
        {top: '20%',bottom: '25%',left: '8%',right: '62%'},
        {top: '20%',bottom: '25%',left: '53%',right: '8%'},   
    ],
    series: [{
        type:'line',
        name: '荣耀销量',
        data:[85,71,74,89,47,91,78],
        label: {
            show: true,
        },
        stack: '总量',
        areaStyle: {},
        xAxisIndex: 0,
        yAxisIndex: 0,
    },{
        type:'line',
        name: '小米销量',
        data:[72,47,57,78,74,85,57],
        label: {
            show: true,
        },
        stack: '总量',
        areaStyle: {},
        xAxisIndex: 0,
        yAxisIndex: 0,
    },{
        type:'bar',
        name: '荣耀销量',
        data:[85,71,74,89,47,91,78],
        label: {
            show: true,
        },
        xAxisIndex: 1,
        yAxisIndex: 1,
        stack: '总量1',
    },{
        type:'bar',
        name: '小米销量',
        stack: '总量1',
        data:[72,47,57,78,74,85,57],
        label: {
            show: true,
        },
        xAxisIndex: 1,
        yAxisIndex: 1,
    }],
};
myChart3.setOption(option3)
//--------------------------------------
var myChart4 = echarts.init(document.getElementById("idx4"))
var option4 = {
    title: {
        text: '成绩占比',
        subtext: '周子昂',
    },
    legend: {
        show: true,
    },
    series:[{
        type:'pie',
        center: ['25%','50%'],
        radius: [0,'40%'],
        name:'美国销量',
        data:[
            {value:85,name:"小米"},
            {value:71,name:"荣耀"},
            {value:74,name:"vivo"},
        ],
        label:{
            position:'inside',
        },
    },{
        type:'pie',
        name:'中国销量',
        center: ['75%','50%'],
        data:[
            {value:72,name:"小米"},
            {value:47,name:"荣耀"},
            {value:57,name:"vivo"},
        ],
        label:{
            position:'inside',
        },
        radius: [0,'40%'],
    }],
    legend: {
        orient: 'horizontal',
        left: 'center',
        top:'230px',
    },
};
myChart4.setOption(option4);
//--------------------------------------
var myChart5 = echarts.init(document.getElementById("idx5"));
//配置绘图参数
var option5 = {
    baseOption:{//不变的东西
        timeline:{
            axisType:'category',
            autoPlay:'true',
            playInterval:1000,
            data:['2016','2017','2018','2019','2020']
        },
        title:{
            text:'成绩变化',
            left:'center',

        },
        xAxis:{
            type:'category',
            name:'国家',
            data:['中国','美国','日本','德国','英国'],
        },
        yAxis:{
            name:'近几年GDP',
            min:0,
            max:30,
        },

    },
    options:[{//变的东西
        series:{
            type:'bar',
            data:[11.23,18.75,5.01,3.47,2.72],
        }
        },{
            series:{
                type:'bar',
                data:[12.31,19.54,4.93,3.68,2.71],
            }
        },{
            series:{
                type:'bar',
                data:[12.89,20.61,5.04,5.51,5.06],
            }
        },{
            series:{
                type:'bar',
                data:[14.28,21.43,5.51,3.89,2.88],
            }
        },{
            series:{
                type:'bar',
                data:[14.72,20.95,5.06,3.85,2.26],
            }
        }],
};
    //画图
myChart5.setOption(option5);
//--------------------------------------
$.get("js/20信息技术班级成绩.csv",function(data){
    var ndata = data.split('\r\n');
    var new_data = []
    for(var i=0;i<ndata.length;i++){
        new_data.push(ndata[i].split(','))
    }
    console.log(new_data);
    
var company = [];
var salary = [];
var banji = [];
var banji1 = [];
for(var i=1;i<new_data.length;i++){
    company.push(new_data[i][1]);
    salary.push(new_data[i][2]);
    if(new_data[i][0]='20信息技术1班'){
        banji.push(new_data[i][2]);
    }else{
        banji1.push(new_data[i][2]);
    }
}
 var myChart6 = echarts.init(document.getElementById("idx6"));
 var option6 = {
     title: {
         text: '班级—周子昂',
         left: 'center',
     },
    xAxis: {
        type: 'category',
        data: company,
        name: '公司名称',
    },
    yAxis: {
        name: '成绩',
    },
    series:[{
        type:'line',
        data:banji,
        label: {
            show: true,
        },
    },{
        type:'line',
        data:banji1,
        label: {
            show: true,
        }, 
    }
   ],
 };
 myChart6.setOption(option6);
});